
// 桌面提醒
let notification;
export default function Notify(title = "Hello,Tobog", body = "任务正在处理中...") {
    if (!window.Notification) return
    if (notification) notification.close();
    if (Notification.permission === "granted") {
        notification = new Notification(title, { body });
        return
    }
    if (Notification.permission !== 'denied') {
        Notification.requestPermission(function (permission) {
            // 如果用户同意，就可以向他们发送通知
            if (permission === "granted") notification = new Notification(title, { body });
        });
    }
}